#pragma once
#include "Object.h"
#include "Batch3D.h"

class GameObject;
class Mesh;
class  Component : public Object
{

public:
	explicit Component(Context* context);
	~Component() override;

	void SetEnabled(bool enable);
	bool GetEnabled() { return enable_; }

	void OnInit(GameObject* owner);

	virtual void OnStart() {};
	virtual void OnDestory() {};

	virtual void OnEnable() {};
	virtual void OnDisable() {};

	virtual std::shared_ptr<Component> Clone() { return nullptr; };

	virtual void Update(float dt) {};
	virtual void GetBatch(std::vector<Batch3D>& batches) {};
	virtual std::string GetComponentName() { return "Component"; };

	GameObject* GetOwner() { return gameObject_; }
	void MarkDirty() { gameObjectDirty_ = true; }
protected:
	int order_{};
	unsigned flag_{};
	bool enable_{ true };
	GameObject* gameObject_{};
	bool gameObjectDirty_{ true };
};

